//导航下拉菜单
$("#b2").hover(function() {
	$("#menu").css("display", "block");
}, function() {
	$("#menu").css("display", "none");
});
$("#menu").hover(function() {
	$("#menu").css("display", "block");
}, function() {
	$("#menu").css("display", "none");
});
//二维码
$("#weixin").hover(function() {
	$("#code").css("display", "block");
}, function() {
	$("#code").css("display", "none");
});
$("#pic1").on("click", function() {
	window.open("http://www.subway.com.cn/images/uploadImg/2016040117224114977a.png");
});
$("#pic2").on("click", function() {
	window.open("http://www.subway.com.cn/images/uploadImg/201612191444322d3b38.jpg");
});
//中英文切换
function setLanguage(value) {
	var selectedOption = value.options[value.selectedIndex];
	if(selectedOption.value == "chn") {
		selLanguage(CHNObj);
		$("#position").css("background-image", "url(../img/HomePageImgs/home-box-1_CN.jpg)");
		$("#order").css("background-image", "url(../img/HomePageImgs/home-box-2_CN.jpg)");
		$("#activity").css("background-image", "url(../img/HomePageImgs/home-box-3_CN.jpg)");
		$("#weibo").css("background-image", "url(../img/HomePageImgs/weibo_CN.jpg)");
		$("#weixin").css("background-image", "url(../img/HomePageImgs/weixin_CN.jpg)");
		$("#position").hover(function() {
			$("#position").css("background-image", "url(../img/HomePageImgs/home-box-1_CN_hover.jpg)");
		}, function() {
			$("#position").css("background-image", "url(../img/HomePageImgs/home-box-1_CN.jpg)");
		});
		$("#order").hover(function() {
			$("#order").css("background-image", "url(../img/HomePageImgs/home-box-2_CN_hover.jpg)");
		}, function() {
			$("#order").css("background-image", "url(../img/HomePageImgs/home-box-2_CN.jpg)");
		});
		$("#activity").hover(function() {
			$("#activity").css("background-image", "url(../img/HomePageImgs/home-box-3_CN_hover.jpg)");
		}, function() {
			$("#activity").css("background-image", "url(../img/HomePageImgs/home-box-3_CN.jpg)");
		});
		$("#weibo").hover(function() {
			$("#weibo").css("background-image", "url(../img/HomePageImgs/weibo_CN_hover.jpg)");
		}, function() {
			$("#weibo").css("background-image", "url(../img/HomePageImgs/weibo_CN.jpg)");
		});
		$("#weixin").hover(function() {
			$("#weixin").css("background-image", "url(../img/HomePageImgs/weixin_CN_hover.jpg)");
		}, function() {
			$("#weixin").css("background-image", "url(../img/HomePageImgs/weixin_CN.jpg)");
		});
	} else if(selectedOption.value == "eng") {
		selLanguage(ENGObj);
		$("#position").css("background-image", "url(../img/HomePageImgs/home-box-1_EN.jpg)");
		$("#order").css("background-image", "url(../img/HomePageImgs/home-box-2_EN.jpg)");
		$("#activity").css("background-image", "url(../img/HomePageImgs/home-box-3_EN.jpg)");
		$("#weibo").css("background-image", "url(../img/HomePageImgs/weibo_EN.jpg)");
		$("#weixin").css("background-image", "url(../img/HomePageImgs/weixin_EN.jpg)");
		$("#position").hover(function() {
			$("#position").css("background-image", "url(../img/HomePageImgs/home-box-1_EN_hover.jpg)");
		}, function() {
			$("#position").css("background-image", "url(../img/HomePageImgs/home-box-1_EN.jpg)");
		});
		$("#order").hover(function() {
			$("#order").css("background-image", "url(../img/HomePageImgs/home-box-2_EN_hover.jpg)");
		}, function() {
			$("#order").css("background-image", "url(../img/HomePageImgs/home-box-2_EN.jpg)");
		});
		$("#activity").hover(function() {
			$("#activity").css("background-image", "url(../img/HomePageImgs/home-box-3_EN_hover.jpg)");
		}, function() {
			$("#activity").css("background-image", "url(../img/HomePageImgs/home-box-3_EN.jpg)");
		});
		$("#weibo").hover(function() {
			$("#weibo").css("background-image", "url(../img/HomePageImgs/weibo_EN_hover.jpg)");
		}, function() {
			$("#weibo").css("background-image", "url(../img/HomePageImgs/weibo_EN.jpg)");
		});
		$("#weixin").hover(function() {
			$("#weixin").css("background-image", "url(../img/HomePageImgs/weixin_EN_hover.jpg)");
		}, function() {
			$("#weixin").css("background-image", "url(../img/HomePageImgs/weixin_EN.jpg)");
		});	
	}
}

function selLanguage(obj) {
	$("#language>span").html(obj.country);
	$("#address").html(obj.worldWidle);
	$("#b1").html(obj.navOne);
	$("#b2").html(obj.navTwo);
	$("#b3").html(obj.navThree);
	$("#b4").html(obj.navFour);
	$("#b5").html(obj.navFive);
	$("#menu1").html(obj.navTwoFirst);
	$("#menu2").html(obj.navTwoSecond);
	$("#menu3").html(obj.navTwoThrid);
	$("#menu4").html(obj.navTwoForth);
	$("#menu5").html(obj.navTwoFifth);
	$("#menu6").html(obj.navTwoSixth);
	$("#menu7").html(obj.navTwoSeventh);
	$("#menu8").html(obj.navTwoEighth);
	$("#menu9").html(obj.navTwoNinth);
	$("#menu10").html(obj.navTwoTenth);
	$("#menu11").html(obj.navTwoEleventh);
	$("#home").html(obj.page);
	$("#yingyang").html(obj.menu);
	$("#join").html(obj.join);
	$("#us").html(obj.about);
	$("#search").html(obj.positionSearch);
	$("#contact").html(obj.contact);
	$("#use").html(obj.clause);
	$("#secret").html(obj.policy);
}
//右侧动画
function show() {
	var i = 2;
	var picArr = ["url(../img/HomePageImgs/pic3.jpg)","url(../img/HomePageImgs/pic2.jpg)","url(../img/HomePageImgs/pic1.jpg)"];
	setInterval(function() {
		$(".imgBig").eq(i).animate({
			top: 0
		}, 1000, Fq);
	}, 10000);

	function Fq() {
		$(".textBig").eq(i).animate({
			left: 0
		}, 2000, Fw);
	}

	function Fw() {
		$(".textSmall").eq(i).animate({
			left: 0
		}, 2000, Fe);
	}

	function Fe() {
		$(".textBig").eq(i).animate({
			left: 288
		}, 2000, Fr);
	}

	function Fr() {
		$(".textBig").eq(i).css({
			left: -288
		});
		$(".textSmall").eq(i).animate({
			left: 288
		}, 2000, Ft);
	}

	function Ft() {
		$(".textSmall").eq(i).css({
			left: -288
		});
		$(".imgBig").eq(i).animate({
			top: -156
		}, 1000, Fy);
	}

	function Fy() {
		$("#right").animate({
			opacity: 0
		}, 1000, Fu);
	}

	function Fu() {
		i--;
		if(i < 0) {
			i = 2;
		}
		$("#right").css({
			opacity: 1
		})
		$("#right").css("background",picArr[i]);
		$("#right").css("background-repeat","no-repeat");
	}

}
show();